<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>5.姓名案例--插值语法</title>
        <!-- 引入Vue -->
        <script src="../js/vue.js"></script>
    </head>
    <body>
        <!-- 准备好一个容器-->
        <div id="app">
            <h1>{{age}}</h1>
            <input type="text" v-model="age">

            <hr>

            姓：<input type="text" v-model="firstName" /><br><br>
            名：<input type="text" v-model="lastName" /><br><br>
            <h1>全名：{{fullName()}}</h1>
        </div>
    </body>

    <script>
        let vm = new Vue({
            el:"#app",
            data:{
                age:18,
                firstName:"zhang",
                lastName:"san"
            },
            methods:{
                fullName(){
                    console.log("我是fullName，我被执行了")
                    // console.log(this);
                    //解构赋值
                    let {firstName,lastName} = this;
                    return firstName[0].toUpperCase()+firstName.slice(1)  +"-"+  lastName[0].toUpperCase()+lastName.slice(1);
                }
            }
        })

        // console.log(vm);
    </script>
</html>